package com.fyzk.activity.trend;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.annotation.Nullable;
import android.util.AttributeSet;

import com.tyjc.lottery.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanxs11 on 2017/7/20.
 */

public class Gp11x5TrendView extends TrendBaseView {

    private int chooseId = R.id.trend_choose_rb2;
    private int payType = 0;

    public Gp11x5TrendView(Context context) {
        super(context);
    }

    public Gp11x5TrendView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public Gp11x5TrendView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void initData() {
        rowVisibleCount = 13;
        topPaddingCount = 1;
        leftPpaddingCount = 2;
        scale = 1.0f;
        rowCount = 11;
        phaseLength = 2;
        super.initData();
    }

    @Override
    boolean isShowBottom(List<Drawinfor> infors) {
        infors.clear();
        for (int i = 0; i < 11; i++) {
            Drawinfor drawinfor = new Drawinfor();

            drawinfor.type = 0;

            if ((i+1) < 10) {
                drawinfor.text = "0"+(i+1);
            } else {
                drawinfor.text = ""+(i+1);
            }
            infors.add(drawinfor);
        }

//        return jcInfors.size() != 0;
        return false;
    }

    @Override
    protected void onDrawTop(Canvas canvas, Rect rect) {
        paintBg.setColor(topBg);
        paintTop.setColor(textColor666);
        super.onDrawTop(canvas, rect);
        Rect topRect = new Rect(rect.left,rect.top, rect.left, rect.top);
        paintLine.setColor(lineColor);
        switch (chooseId) {
            case R.id.trend_choose_rb1:
                topRect.set(topRect.left, topRect.top, topRect.left+unitLength*5,topRect.top+unitLength);
                drawText(canvas, paintTop, "开奖号码", topRect);
                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                topRect.set(topRect.right,topRect.top,topRect.right+unitLength*3,topRect.top+unitLength);
                drawText(canvas, paintTop, "和值", topRect);
                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                topRect.set(topRect.right,topRect.top,topRect.right+unitLength*3,topRect.top+unitLength);
                drawText(canvas, paintTop, "跨度", topRect);
//                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
//                topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
//                drawText(canvas, paintTop, "重号个数", topRect);
                break;
            case R.id.trend_choose_rb2:
                for (int i = 0; i < rowCount; i++) {
                    topRect.set(topRect.right, topRect.top, topRect.right+unitLength,topRect.top+unitLength);
                    String num;
                    if (i + 1 < 10) {
                        num = "0"+(i+1);
                    } else {
                        num = ""+(i+1);
                    }
                    drawText(canvas, paintTop, ""+num, topRect);
                    if (i < rowCount-1) {
                        canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                    }
                }
                break;
            case R.id.trend_choose_rb3:
                switch (payType) {
                    case 8:     // 前二直选
                    case 10:    // 前三直选
                        for (int i = 0; i < rowCount; i++) {
                            topRect.set(topRect.right, topRect.top, topRect.right+unitLength,topRect.top+unitLength);
                            String num;
                            if (i + 1 < 10) {
                                num = "0"+(i+1);
                            } else {
                                num = ""+(i+1);
                            }
                            drawText(canvas, paintTop, ""+num, topRect);
                            if (i < rowCount-1) {
                                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                            }
                        }
                        break;
                    default:
                        String[] titles = {"30期","50期","100期","遗漏"};
                        for (int i = 0; i < titles.length; i++) {
                            topRect.set(topRect.right, topRect.top, (int) (topRect.right+unitLength*2.75),topRect.top+unitLength);
                            String num = ""+titles[i];
                            drawText(canvas, paintTop, ""+num, topRect);
                            if (i < titles.length-1) {
                                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                            }
                        }
                        break;
                }
                break;
            case R.id.trend_choose_rb4:
                switch (payType) {
                    case 7: // 前一
                        String[] titles = {"奇","偶","质","合","0路","1路","2路"};
                        for (int i = 0; i < titles.length; i++) {
                            topRect.set(topRect.right, topRect.top, (int) (topRect.right+unitLength*1.572),topRect.top+unitLength);
                            String num = ""+titles[i];
                            drawText(canvas, paintTop, ""+num, topRect);
                            if (i < titles.length-1) {
                                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                            }
                        }
                        break;
                    case 10:    // 前三直选
                        for (int i = 0; i < rowCount; i++) {
                            topRect.set(topRect.right, topRect.top, topRect.right+unitLength,topRect.top+unitLength);
                            String num;
                            if (i + 1 < 10) {
                                num = "0"+(i+1);
                            } else {
                                num = ""+(i+1);
                            }
                            drawText(canvas, paintTop, ""+num, topRect);
                            if (i < rowCount-1) {
                                canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                            }
                        }
                        break;
                    default:
                        topRect.set(topRect.left, topRect.top, topRect.left+unitLength*5,topRect.top+unitLength);
                        drawText(canvas, paintTop, "开奖号码", topRect);
                        canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                        topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
                        drawText(canvas, paintTop, "大小比", topRect);
                        canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                        topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
                        drawText(canvas, paintTop, "奇偶比", topRect);
                        canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                        topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
                        drawText(canvas, paintTop, "质合比", topRect);

                        break;
                }
                break;
            default:
                break;
        }

        paintLine.setColor(textDefault);
        canvas.drawLine(rect.left, rect.bottom-1, rect.right, rect.bottom-1, paintLine);
    }

    @Override
    protected void onDrawLeft(Canvas canvas, int left, int top) {
        if (chooseId == R.id.trend_choose_rb3 && payType != 8 && payType != 10) {
            for (int i = 0; i < columnCount; i++) {
                rectCenter.left = left;
                rectCenter.right = rectCenter.left + leftWidth;
                rectCenter.top = top + i*unitLength;
                rectCenter.bottom = rectCenter.top + unitLength;

                if (i % 2 == 0) {
                    paintBg.setColor(bgBai);
                } else {
                    paintBg.setColor(bgHui);
                }
                canvas.drawRect(rectCenter, paintBg);
                canvas.drawLine(rectCenter.left, rectCenter.bottom, rectCenter.right, rectCenter.bottom, paintLine);
                String num = "";
                if (i+1 < 10) {
                    num = "0"+(i+1);
                } else {
                    num = ""+(i+1);
                }
                if (i < 11) {
                    paintCircle.setColor(redColor);
                    paintCircle.setStyle(Paint.Style.FILL);
                    canvas.drawCircle(rectCenter.centerX(), rectCenter.centerY(), rectCenter.height()/2-4, paintCircle);
                    paintText.setColor(Color.WHITE);
                    drawText(canvas, paintText, ""+num, rectCenter);
                }
                canvas.drawLine(rectCenter.right-1, rectCenter.top, rectCenter.right-1, rectCenter.bottom, paintLine);
            }
            if (drawHeight > unitLength*columnCount) {
                Rect bgRect = new Rect(left, top+columnCount*unitLength, leftWidth, top+drawHeight);
                paintBg.setColor(bgBai);
                canvas.drawRect(bgRect, paintBg);
                canvas.drawLine(bgRect.right-1, bgRect.top, bgRect.right-1, bgRect.bottom, paintLine);
            }
        } else {
            super.onDrawLeft(canvas, left, top);
        }
    }

    @Override
    protected void onDrawBottom(Canvas canvas, Rect rect) {
        super.onDrawBottom(canvas, rect);
        int prizeNumWidth = 0;   // 开奖号码占据的宽度

        Rect chooseNumRect = new Rect(rect.left+prizeNumWidth,rect.top,rect.right,rect.top+rect.height()*2/3);
        Rect alreadyChooseNumRect = new Rect(rect.left+prizeNumWidth+getScrollX(),rect.top+rect.height()/2,rect.right,rect.bottom);

        Rect numRect = new Rect(alreadyChooseNumRect.left,alreadyChooseNumRect.top,alreadyChooseNumRect.left+unitLength*2/3,alreadyChooseNumRect.bottom);
        for (int i = 0; i < bottomInfors.size(); i++) {
            Drawinfor drawinfor = bottomInfors.get(i);
            Rect redNumRect = new Rect(chooseNumRect.left+unitLength*(i),chooseNumRect.top,chooseNumRect.left+unitLength*(i+1),chooseNumRect.bottom);
            drawinfor.rect = redNumRect;

            if (drawinfor.type == 0) {
                paintCircle.setColor(redColor);
            } else {
                paintCircle.setColor(blueColor);
            }

            if (drawinfor.isCheck) {
                paintText.setColor(Color.WHITE);
                paintCircle.setStyle(Paint.Style.FILL);

                drawText(canvas, paintCircle, drawinfor.text, numRect);
                numRect = new Rect(numRect.right, numRect.top, numRect.right+unitLength*2/3,numRect.bottom);
            } else {
                paintText.setColor(paintCircle.getColor());
                paintCircle.setStyle(Paint.Style.STROKE);
            }
            canvas.drawCircle(redNumRect.centerX(), redNumRect.centerY(), redNumRect.width()/2-4, paintCircle);

            drawText(canvas, paintText, drawinfor.text, redNumRect);

        }
    }

    @Override
    protected void onDrawCenter(Canvas canvas, int left, int top) {
        switch (chooseId) {
            case R.id.trend_choose_rb1:
                drawCenterPrize(canvas, left, top);
                break;
            case R.id.trend_choose_rb2:
                drawCenterTrend(canvas, left, top);
                break;
            case R.id.trend_choose_rb3:
                drawCenterHot(canvas, left, top);
                break;
            case R.id.trend_choose_rb4:
                drawCenterShap(canvas, left, top);
                break;
            default:
                break;
        }
    }

    private void drawCenterBg(Canvas canvas, int left, int top, int i) {
        Rect bgRect = new Rect(left, top+i*unitLength, drawWidth, top+(i+1)*unitLength);
        if (i % 2 == 0) {
            paintBg.setColor(bgBai);
        } else {
            paintBg.setColor(bgHui);
        }

        canvas.drawRect(bgRect, paintBg);
        paintLine.setColor(textDefault);
        canvas.drawLine(bgRect.left, bgRect.bottom, bgRect.right, bgRect.bottom, paintLine);
    }

    // 开奖
    private void drawCenterPrize(Canvas canvas, int left, int top) {
        // 数据
        List<TrendBean.IssuesBean> infors = new ArrayList<>();
        if (trendBean != null && trendBean.getIssues() != null && trendBean.getIssues().size() > 0) {
            infors = trendBean.getIssues();
        }

        Rect topRect = new Rect(left,top,left,top);
        for (int i = 0; i < columnCount; i++) {
            String windCode = "";
            String andValue = "";
            String spanValue = "";
            if (infors != null && i < infors.size()) {
                TrendBean.IssuesBean infor = infors.get(i);
                windCode = infor.getWincode();
                andValue = infor.getAndValue();
                spanValue = infor.getSpanValue();
            }
            topRect.set(left,topRect.bottom,left,topRect.bottom+unitLength);
            drawCenterBg(canvas, left, top, i);

            paintLine.setColor(lineColor);
            paintText.setColor(redColor);
            topRect.set(topRect.left, topRect.top, topRect.left+unitLength*5,topRect.top+unitLength);
            drawText(canvas, paintText, windCode, topRect);
            canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
            paintText.setColor(textColorMiss);
            topRect.set(topRect.right,topRect.top,topRect.right+unitLength*3,topRect.top+unitLength);
            drawText(canvas, paintText, andValue, topRect);
            canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
            topRect.set(topRect.right,topRect.top,topRect.right+unitLength*3,topRect.top+unitLength);
            drawText(canvas, paintText, spanValue, topRect);
//            canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
//            topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
//            drawText(canvas, paintText, "重号个数", topRect);
        }
    }

    // 走势
    private void drawCenterTrend(Canvas canvas, int left, int top) {
        // 数据
        List<TrendBean.MissesBean> infors = new ArrayList<>();
        if (trendBean != null && trendBean.getMisses() != null && trendBean.getMisses().size() > 0) {
            infors = trendBean.getMisses();
        }
        Rect topRect = new Rect(left,top,left,top);
        List<Drawinfor> drawinfors = new ArrayList<>();
        for (int i = 0; i < columnCount; i++) {
            List<Integer> missValues = new ArrayList<>();
            if (infors.size() > 0) {
                missValues = infors.get(i).getMissValues(missTitle);
            }
            drawCenterBg(canvas, left, top, i);

            topRect.set(left,topRect.bottom,left,topRect.bottom+unitLength);
            paintLine.setColor(lineColor);

            for (int j = 0; j < rowCount; j++) {
                topRect.set(topRect.right, topRect.top, topRect.right+unitLength,topRect.top+unitLength);
                String num = ""+j;
                if (missValues.size() > 0) {
                    if (missValues.get(j) == 0) {
                        Drawinfor drawinfor = new Drawinfor();
                        if (j+1 < 10) {
                            num = "0"+(j+1);
                        } else {
                            num = ""+(j+1);
                        }
                        drawinfor.text = num;
                        drawinfor.rect = new Rect(topRect.left, topRect.top, topRect.right, topRect.bottom);
                        drawinfor.shapType = 0;
                        drawinfor.textColor = Color.WHITE;
                        drawinfor.shapColor = redColor;
                        drawinfors.add(drawinfor);
                    }
                    if (isYL) {
                        num = ""+missValues.get(j);
                    } else {
                        num = "";
                    }
                }
                drawText(canvas, paintTop, ""+num, topRect);
                if (j < rowCount-1) {
                    canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                }
            }
            if (i == columnCount - 1) {
                switch (payType) {
                    case 7:
                    case 8:
                    case 10:
                        drawShap(canvas, drawinfors, isZX);
                        break;
                    default:
                        drawShap(canvas, drawinfors, false);
                        break;
                }
            }
        }

    }

    // 冷热
    private void drawCenterHot(Canvas canvas, int left, int top) {

        switch (payType) {
            case 8:     // 前二直选
            case 10:    // 前三直选
                drawCenterTrend(canvas, left, top);
                break;
            default:
                List<TrendBean.HcsBean> hcsInfors = new ArrayList<>(); // 冷热
                if (trendBean != null && trendBean.getHcs() != null && trendBean.getHcs().size() > 0) {
                    hcsInfors = trendBean.getHcs();
                }
                // 遗漏数据
                List<TrendBean.MissesBean> infors = new ArrayList<>();
                if (trendBean != null && trendBean.getMisses() != null && trendBean.getMisses().size() > 0) {
                    infors = trendBean.getMisses();
                }
                List<Integer> missValues = new ArrayList<>();
                if (infors.size() > 0) {
                    missValues = infors.get(infors.size()-1).getMissValues(missTitle);
                }

                Rect topRect = new Rect(left,top,left,top);
                for (int i = 0; i < columnCount; i++) {
                    drawCenterBg(canvas, left, top, i);

                    topRect.set(left,topRect.bottom,left,topRect.bottom+unitLength);
                    paintLine.setColor(lineColor);

                    int rCount = 4;
                    for (int j = 0; j < rCount; j++) {
                        String num = "";
                        if (hcsInfors.size() > 0) {
                            if (j < hcsInfors.size()) {
                                TrendBean.HcsBean hcsInfor = hcsInfors.get(j);
                                List<Integer> hcValues = hcsInfor.getHcValues(hcTitle);
                                if (i < hcValues.size()) {
                                    num = ""+hcValues.get(i);
                                    if (hcValues.get(i) == hcsInfor.maxHc) {
                                        paintTop.setColor(redColor);
                                    } else {
                                        paintTop.setColor(textColorMiss);
                                    }
                                }
                            } else {
                                if (i<missValues.size()){
                                    num = ""+missValues.get(i);
                                    if (missValues.get(i) == infors.get(infors.size()-1).maxMiss) {
                                        paintTop.setColor(redColor);
                                    } else {
                                        paintTop.setColor(textColorMiss);
                                    }
                                }
                            }
                        }
                        topRect.set(topRect.right, topRect.top, (int) (topRect.right+unitLength*2.75),topRect.top+unitLength);
                        drawText(canvas, paintTop, ""+num, topRect);
                        if (j < 3) {
                            canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                        }
                    }
                }

                break;
        }

        if (drawHeight > unitLength*columnCount) {
            Rect bgRect = new Rect(left, top+columnCount*unitLength, drawWidth, top+drawHeight);
            paintBg.setColor(bgBai);
            canvas.drawRect(bgRect, paintBg);
        }
    }

    // 形态
    private void drawCenterShap(Canvas canvas, int left, int top) {

        switch (payType) {
            case 7: // 前一

                List<Drawinfor> infors1 = new ArrayList<>();
                List<Drawinfor> infors2 = new ArrayList<>();
                List<Drawinfor> infors3 = new ArrayList<>();
                Rect topRect = new Rect(left,top,left,top);
                for (int i = 0; i < columnCount; i++) {
                    drawCenterBg(canvas, left, top, i);

                    topRect.set(left, topRect.bottom, left, topRect.bottom + unitLength);
                    paintLine.setColor(lineColor);
                    paintTop.setColor(redColor);

                    String[] titles = {"奇","偶","质","合","0路","1路","2路"};
                    for (int j = 0; j < titles.length; j++) {
                        topRect.set(topRect.right, topRect.top, (int) (topRect.right+unitLength*1.572),topRect.top+unitLength);
                        if (j < titles.length-1) {
                            canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                        }
                        // 模拟 待替换...
                        String text = "";
                        if ((j % 2 == 0 && i % 2 == 0) || (j % 2 != 0 && i % 2 != 0)) {
                            text = titles[j];
                            Drawinfor drawinfor = new Drawinfor();
                            drawinfor.text = text;
                            drawinfor.rect = new Rect(topRect.left, topRect.top, topRect.right, topRect.bottom);
                            drawinfor.shapType = 1;
                            drawinfor.textColor = Color.WHITE;
                            if (j < 2) {
                                drawinfor.shapColor = color_shap1;
                                infors1.add(drawinfor);
                            } else if (j < 4) {
                                drawinfor.shapColor = color_shap2;
                                infors2.add(drawinfor);
                            } else {
                                drawinfor.shapColor = color_shap3;
                                infors3.add(drawinfor);
                            }
                        } else {
                            text = ""+j;
                            drawText(canvas, paintTop, text, topRect);
                        }
                    }
                    if (i == columnCount - 1) {

                        drawShap(canvas, infors1, isZX);
                        drawShap(canvas, infors2, isZX);
                        drawShap(canvas, infors3, isZX);
                    }

                }

                break;
            case 10:    // 前三直选
                drawCenterTrend(canvas, left, top);
                break;
            default:
                // 数据
                List<TrendBean.IssuesBean> infors = new ArrayList<>();
                if (trendBean != null && trendBean.getIssues() != null && trendBean.getIssues().size() > 0) {
                    infors = trendBean.getIssues();
                }

                topRect = new Rect(left,top,left,top);
                for (int i = 0; i < columnCount; i++) {
                    String windCode = "";
                    String bigSmall = "";
                    String oddEven = "";
                    String prime = "";
                    if (infors != null && i < infors.size()) {
                        TrendBean.IssuesBean infor = infors.get(i);
                        windCode = infor.getWincode();
                        bigSmall = infor.getBigsmall();
                        oddEven = infor.getOddEvenValue();
                        prime = infor.getPrimeValue();
                    }
                    drawCenterBg(canvas, left, top, i);

                    topRect.set(left, topRect.bottom, left, topRect.bottom + unitLength);
                    paintLine.setColor(lineColor);
                    paintTop.setColor(redColor);

                    topRect.set(topRect.left, topRect.top, topRect.left+unitLength*5,topRect.top+unitLength);
                    drawText(canvas, paintTop, windCode, topRect);
                    canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                    paintTop.setColor(textColorMiss);
                    topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
                    drawText(canvas, paintTop, bigSmall, topRect);
                    canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                    topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
                    drawText(canvas, paintTop, oddEven, topRect);
                    canvas.drawLine(topRect.right-1, topRect.top, topRect.right-1, topRect.bottom, paintLine);
                    topRect.set(topRect.right,topRect.top,topRect.right+unitLength*2,topRect.top+unitLength);
                    drawText(canvas, paintTop, prime, topRect);
                }

                break;
        }

    }

    @Override
    public void onChooseClick(int id) {
        chooseId = id;
        setRowCount(11);
        switch (id) {
            case R.id.trend_choose_rb1:
                setColumnCount(50, false);
                break;
            case R.id.trend_choose_rb2:
                setColumnCount(50, false);
                break;
            case R.id.trend_choose_rb3:
                switch (payType) {
                    case 7: // 前一
                        setColumnCount(11, true);
                        break;
                    case 8: // 前二
                        setColumnCount(50, false);
                        break;
                    case 10:    // 前三
                        setColumnCount(50, false);
                        break;
                    default:
                        setColumnCount(11, true);
                        break;
                }
                break;
            case R.id.trend_choose_rb4:
                setColumnCount(50, false);
                break;
            default:
                break;
        }
        setMissTitle(chooseId, payType);
        recording();
        setScrollY(0);
        invalidate();
    }

    @Override
    public void onChangePayType(int id) {
        payType = id;
        setMissTitle(chooseId, payType);
    }

    private void setMissTitle(int chooseId, int payType) {
        hcTitle = "hc";
        switch (chooseId) {
            case R.id.trend_choose_rb2:
                switch (payType) {
                    case 7:
                        missTitle = "ge";
                        break;
                    case 8:
                        missTitle = "shi";
                        break;
                    case 10:
                        missTitle = "bai";
                        break;
                    default:
                        missTitle = "miss";
                        break;
                }
                break;
            case R.id.trend_choose_rb3:
                switch (payType) {
                    case 7:
                        hcTitle = "ge";
                        break;
                    case 8:     // 前二直选
                        missTitle = "ge";
                        break;
                    case 10:    // 前三直选
                        missTitle = "shi";
                        break;
                    default:
                        break;
                }
                break;
            case R.id.trend_choose_rb4:
                missTitle = "ge";
                break;
            default:
                break;
        }
    }
}
